package com.flydust.apipulse.repository;

import com.flydust.apipulse.entity.Project;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ProjectRepository extends JpaRepository<Project, Long> {
    @Query("SELECT p, COUNT(e) FROM Project p LEFT JOIN p.endpoints e GROUP BY p")
    List<Object[]> findAllWithEndpointCount();
}